package com.test.ioc.dao;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author SN
 * @date 2020/4/17 13:22
 * @desc
 */
@Repository
//@Scope("singleton")  单例, 默认
//@Scope("prototype")  多例
public class UserDaoImpl implements InitializingBean, DisposableBean {
    public void destroy() throws Exception {
        System.out.println("UserDaoImpl销毁了");
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("UserDaoImpl创建了");
    }

    //@PostConstruct
//    public void userInit(){
//        System.out.println("UserDaoImpl创建了");
//    }
//
//    //@PreDestroy
//    public void userDestroy(){
//        System.out.println("UserDaoImpl销毁了");
//    }

}